body {
    font-family: sans-serif;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 0;
    padding: 1rem;
    background-color: #f0f0f0;
    color: #333;
}

h1 {
    margin-top: 0;
    margin-bottom: 1rem;
}

.controls {
    margin-bottom: 1rem;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 15px;
    background: white;
    padding: 10px 20px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

label {
    font-weight: bold;
}

input[type="color"] {
    width: 40px;
    height: 40px;
    border: none;
    padding: 0;
    border-radius: 50%;
    cursor: pointer;
    background-color: transparent;
}

input[type="range"] {
    cursor: pointer;
    width: 120px;
}

#brushSizeValue {
    font-weight: bold;
    min-width: 20px;
    text-align: center;
}

button {
    padding: 8px 15px;
    border: none;
    background-color: #ff4757;
    color: white;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    transition: background-color 0.2s;
}

button:hover {
    background-color: #e04050;
}

#addAiButton {
    background-color: #007bff;
}

#addAiButton:hover {
    background-color: #0069d9;
}

#ai-status-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 1rem;
    justify-content: flex-start;
    align-items: center;
    width: 90%;
    align-self: center;
    padding-left: 0;
}

.ai-status {
    background-color: #fff;
    padding: 5px 10px;
    border-radius: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9em;
}

.ai-icon {
    width: 24px;
    height: 24px;
}

canvas {
    border: 2px solid #333;
    background-color: white;
    cursor: crosshair;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    max-width: 100%;
    flex: 4;
}

#main-content {
    display: flex;
    width: 90%;
    gap: 1rem;
    align-items: stretch;
}

/* Chat System Styles */
#chat-container {
    display: flex;
    flex-direction: column;
    flex: 1;
    background-color: white;
    border: 2px solid #ccc;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    height: 70vh;
    max-height: 70vh;
}

#message-container {
    flex-grow: 1;
    overflow-y: auto;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.chat-message {
    padding: 8px 12px;
    border-radius: 15px;
    max-width: 85%;
    word-wrap: break-word;
}

.chat-message .sender {
    font-weight: bold;
    font-size: 0.9em;
    margin-bottom: 2px;
    color: #333;
}

.user-message {
    background-color: #dcf8c6;
    align-self: flex-end;
    border-bottom-right-radius: 3px;
}

.other-message {
    background-color: #f1f0f0;
    align-self: flex-start;
    border-bottom-left-radius: 3px;
}

.ai-message {
    background-color: #e0f0ff;
    align-self: flex-start;
    border-bottom-left-radius: 3px;
}

.ai-message .sender {
    color: #005f9e;
}

#chat-form {
    display: flex;
    border-top: 1px solid #ddd;
    padding: 10px;
}

#chat-input {
    flex-grow: 1;
    border: 1px solid #ccc;
    border-radius: 20px;
    padding: 8px 15px;
    margin-right: 10px;
}

#chat-form button {
    background-color: #007bff;
    min-width: 70px;
}

#chat-form button:hover {
    background-color: #0069d9;
}